<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let weila = undefined;

    localStorage.debug = "*"

    window.onload = () => {
        console.log(window.wlsdk)
        weila = new window.wlsdk.WeilaCore();
    }

    function init() {
        weila.init();
    }

    function login() {
        weila.weila_login("10000001", "123456", "0", false).then(value => {
            console.log("login result", value);
        }).catch(reason => {
            console.log("login fail", reason);
        });
    }

    function burstReq() {
        weila.weila_requestTalk("12259", 1).then(value => {
            console.log("request talk succ", value);
        }).catch(reason => {
            console.log("request talk fail", reason);
        })
    }

    function burstRelease() {
        weila.weila_releaseTalk(null);
    }

    function sendTxt() {
        weila.weila_sendTextMsg("12259", 1, "你好啊");
    }

    window.onbeforeunload = () => {
        weila.weila_logout();
    }
</script>
    <div>测试页</div>
    <button type="button" onclick="init()">初始化</button>
    <button type="button" onclick="login()">登录</button>
    <button type="button" onclick="burstReq()">讲话</button>
    <button type="button" onclick="burstRelease()">停止讲话</button>
    <button type="button" onclick="sendTxt()">发送文字</button>

</body>
</html>
